<!--
 * @Author: your name
 * @Date: 2021-10-29 11:12:34
 * @LastEditTime: 2021-11-02 21:38:45
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \vue_test\src\components\Test.vue
-->
<template>
  <div>
    <button @click="isShow = !isShow">显示/隐藏</button>
    <!-- <h2 v-show="isShow" class="go">你好啊！</h2> -->
    <transition-group name="hello" appear>
      <h2 v-show="!isShow" key="1">你好啊！</h2>
      <h2 v-show="isShow" key="2">尚硅谷！</h2>
    </transition-group>
  </div>
</template>

<script>
export default {
  name: "Test2",
  data() {
    return {
      isShow: true,
    };
  },
};
</script>

<style scoped>
h2 {
  background-color: orange;
  /*  transition: 1s linear; */
}
/* 进入的起点、离开的终点 */
.hello-enter,
.hello-leave-to {
  transform: translateX(-100%);
}
/* 整个进入、离开的过程 */
.hello-enter-active,
.hello-leave-active {
  transition: 1s linear;
}
/* 进去的终点、离开的起点 */
.hello-enter-to,
.hello-leave {
  transform: translateX(0);
}
</style>
